project('collector', 'c', 'cpp',
    default_options : [
    'b_lto=false',
    #'b_asneeded=false',
    #'b_lundef=false',
    'b_pch=false',
    'b_staticpic=false',
    'c_std=c99',
    'cpp_std=c++11'
    ],
  version : '1.0.1')
cc = meson.get_compiler('c')

ts_version = meson.project_version()
ts_api_version = '1.0'
version_arr = ts_version.split('.')
major_version = version_arr[0].to_int()
minor_version = version_arr[1].to_int()
micro_version = version_arr[2].to_int()

gio_dep = dependency('gio-2.0')
glib_dep = dependency('glib-2.0')
soup_dep = dependency('libsoup-2.4')
sqlite3_dep = dependency('sqlite3')
mosquitto_dep = dependency('libmosquitto')
xml2_dep = dependency('libxml-2.0')
json_glib_dep = dependency('json-glib-1.0')

interface_age = minor_version.is_odd() ? 0 : micro_version
binary_age = 100 * minor_version + micro_version

soversion = 0
# Maintain compatibility with previous libtool versioning
# current = minor * 100 + micro
current = binary_age - interface_age
library_version = '@0@.@1@.@2@'.format(soversion, current, interface_age)
darwin_versions = [current + 1, '@0@.@1@'.format(current + 1, interface_age)]

configinc = include_directories('.')

ts_prefix = get_option('prefix')
ts_bindir = join_paths(ts_prefix, get_option('bindir'))
ts_libdir = join_paths(ts_prefix, get_option('libdir'))
ts_libexecdir = join_paths(ts_prefix, get_option('libexecdir'))
ts_datadir = join_paths(ts_prefix, get_option('datadir'))
ts_pkgdatadir = join_paths(ts_datadir, 'ts-1.0')
ts_includedir = join_paths(ts_prefix, get_option('includedir'))
ts_pkgconfigreldir = join_paths(ts_libdir, 'pkgconfig')

warning_c_link_args = []
glib_link_flags = cc.get_supported_link_arguments(warning_c_link_args)
#libintl_gio = cc.find_library('gio-2.0', required : false)
libintl_gio = []
libintl_deps = []
libintl_deps += [libintl_gio]
default_options = {
    'prefix': '../bin',
    'libdir': 'lib',
    'bindir': 'bin',
    'includedir': 'include',
    'datadir': 'share',
}
if false
  executable('my_project',
    #'my_project.cpp',
    #  dependencies : files_dep, hclient_dep,
    install : true)
endif

test_timeout = 60
test_timeout_slow = 100
pkg = import('pkgconfig')
subdir('STM32F10x_StdPeriph_Lib_V3.6.0')
if true
  subdir('PWM_Output')
endif
